home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / cnetdevice / src / devnotes < prev    next >
Text File  |  2000-05-19  |  4KB  |  75 lines

  1.  
  2. PC-CARDs and the Amiga
  3.  
  4.  For those of you who might want to write drivers for PC-CARDs, here are
  5.  some things I have found out about them.
  6.  
  7.  Most cards are designed to be set up to look like an ISA bus card, which is
  8.  what the peecee needs for software compatibility.
  9.  
  10.  As PCMCIA is quite different from ISA, the peecee has a controller chip
  11.  (PCIC) which can be programmed to translate from one bus to the other.
  12.  Using the PCIC, the PCMCIA memory can be mapped into the I/O and memory
  13.  space expected by an ISA card. Also the INT line is routed to one the ISA
  14.  interrupts. Once this setup has been done, the card would be accessed as if
  15.  it were a standard ISA bus card.
  16.  
  17.  Since the Amiga does not have a PCIC, we can access the memory and I/O
  18.  space directly. The single IRQ is handled for us by card.resource, we
  19.  merely have to provide a routine to run when the interrupt occurs.
  20.  
  21.  It may be necessary to access odd I/O register locations at a different
  22.  address range from the even registers. Apparently this allows the card
  23.  to respond to byte accesses. A typical Amiga memory map for PCMCIA looks
  24.  like this:-
  25.  
  26.  $600000 - $9fffff  RAM (may be a mirror of attribute memory for I/O cards)
  27.  $a00000 - $a1ffff  attribute memory
  28.  $a20000 - $a2ffff  I/O space (16bit and even 8bit registers)
  29.  $a30000 - $a3ffff  I/O space (odd 8bit registers)
  30.  
  31.  If the PC-Card's registers were at the ISA I/O addresses of $0300 and $0301,
  32.  8bit access would appear in the Amiga at locations $a20300 ($0300) and
  33.  $a30300 ($0301). For 16bit access, both bytes would appear at $a20300/1.
  34.  Note that the Amiga PCMCIA slot has its data bus wires swapped to account
  35.  for INTEL's backward byte order.
  36.  
  37.  In order to enable I/O access, the card may need to be programmed by first
  38.  writing to the Card Configuration Register in attribute memory. The location
  39.  of this register can be determined by examining the CONFIGMAP tuple. The
  40.  value to write into the CCR is called the ConfigurationID, which can be
  41.  extracted from any CONFIG tuple. Multiple CONFIG tuples may exist, which
  42.  usually relate to different I/O addresses.
  43.  
  44.  Once you have gathered enough infomation on the card's hardware features,
  45.  you will want to write a program to control it. This will involve use of
  46.  card.resource functions, so it is a good idea to read the docs on this
  47.  (available on the Amiga Developer CD). At a minimum, you will need to call
  48.  the functions OwnCard (to set up the interrupt) and CardMiscControl (to
  49.  enable I/O addressing).
  50.  
  51.  
  52. Interrupt Handling
  53.  
  54.  The Cnet card generates a standard level-sensitive interrupt. However Gayle
  55.  (the custom chip that controls the PCMCIA port) responds to interrupts on
  56.  negative and positive edges only. Since the card.resource resets Gayle's
  57.  interrupt latch after your status interrupt routine finishes, there is a
  58.  small but critical period of time where an interrupt could be missed. The
  59.  result is that the PCMCIA card could be holding its INT line down expecting
  60.  service, but Gayle ignores it because the negative transition occurred
  61.  before her interrupt latch was reset.
  62.  
  63.  Commodore's recommended workaround for this is to add another PORTS
  64.  interrupt server, whose sole job is to make sure that card interrupts
  65.  are not enabled until after the status change interrupt has completed
  66.  (after card.resource has reset the Gayle interrupt latch). This ensures
  67.  that the next downwards transition on the PCMCIA INT line gets detected.
  68.  
  69.  For V39 of card.resource a new method was provided, where by setting a flag
  70.  'CARDB_POSTSTATUS' your status interrupt would be called twice, the second
  71.  time would occur after Gayle had been reset. Unfortantely V39 card.resource
  72.  did not make it into the Kickstart 3.0 ROMS, so this is not an option for
  73.  most A1200s and A600s. However 'CARDB_POSTSTATUS' should be used if V39+
  74.  card.resource is available (Kickstart 3.1 has V40 card.resource).
  75.